
const mongoose = require('mongoose')

const users=mongoose.Schema({
    
    username: String,
    password: {
        type :String,
        default:123456
    },
    cellphone: String,
    status: {
        type: Number,
        enum: [1, 2], //  1表示用户可以使用 2 表示用户被禁用
        default: 1
    },
    age:{
        type:Number,
        default: 18,
    },
    
    headerImg: {
        type: String,
        default: '/public/img/default.webp'
    },
    gender: {
        type: String,
        enum: ['男', '女', '保密'],
        default: '保密'
    },
    createTime: {
        type: Date,
        default: new Date()
    }
})





const userModel = mongoose.model('users', users)

// 1 增加数据  
// new userModel({
//       username:'444444',
//       password:666666,
//       cellphone:13812586568,
//       age:18,
//       gender:'保密',
// }).save().then((res) => {
//     console.log('ok')
//     console.log(res)
// }).catch(err => {
//     console.log('>>>', err)
// })




module.exports ={
  userModel
}